3 ...\PTVR_Researchers\Python_Scripts\Demos\Pointing\
4 reticle_test_angular_size.py
6 (see also ...\PTVR_Researchers\Python_Scripts\Demos\Objects\angular_size_of_object.py )
8 Goal: show how to specify the angular size of a reticle and
9 check this angular value against visual objects.
11 1st test: the angular size of the two objects is 2 deg of visual angle,
12 because the cube's size is set to 0.04 m at 1.15 m which
13 mathematically induces a 2 deg angular size.
15 2nd test: the reticle, whose cursor cone diameter is set to 2 deg,
16 is thus visually superimposed with the 2 deg-diameter sphere.
18 Note 1: When visually controlling angular values, remember that
19 angular values are accurate only when the eyes lie
20 close to the current Coordinate System's origin. Move your head if it
21 is not the case, you can use the Gizmo below your feet: if your head is
22 aligned with the green axis (Y), i.e. just above the CS' origin,
26 Note 2: In this demo, the distance between head and reticle is intentionnally
27 constant and smaller than the distance between head and object.
28 Make sure your head is close to the CS's origin, otherwise the
29 reticle will disappear within the objects if your head is too close
32 Note 3: The reticle belongs to the PTVR category called "flat cursors".
51 my_reticle_diameter_deg = 2
53 my_contingency = ImageContingency.HEADSET
55 my_eye_w_reticle =
"both"
61 sphere_diameter_in_deg = 2
62 sphere_radial_distance_in_m = 1.15
66 sphere_diameter_in_m = \
67 tools.visual_angle_to_size_on_perpendicular_plane (
68 visual_angle_of_centered_object_in_deg = sphere_diameter_in_deg,
69 viewing_distance_in_m = sphere_radial_distance_in_m )
74 cube_radial_distance_in_m = 1.15
81 my_world = The3DWorld ()
83 my_scene = VisualScene ()
87 my_scene.place (my_gizmo, my_world)
89 my_world.translate_coordinate_system_along_global ( np.array([0, 1.2, 0]))
92 reticle_2D_image = RG.ReticleImageFromDrawing ( )
96 head_reticle_distance = sphere_radial_distance_in_m - (5*sphere_diameter_in_m)
98 my_reticle = ImageToContingentCursor (
99 image = reticle_2D_image,
100 eye_with_contingent_cursor = my_eye_w_reticle,
101 is_distance_constant =
True,
102 constant_distance = head_reticle_distance,
103 size_in_degrees= [my_reticle_diameter_deg, my_reticle_diameter_deg] )
105 my_scene.place_contingent_cursor (my_reticle)
109 my_sphere = Sphere ( size_in_meters = sphere_diameter_in_m )
110 my_sphere.set_perimetric_coordinates (eccentricity = 1, halfMeridian = 180,
111 radialDistance = sphere_radial_distance_in_m)
112 my_scene.place ( my_sphere, my_world)
115 my_cube = Cube ( size_in_meters = cube_size_in_m )
116 my_cube.set_perimetric_coordinates (eccentricity = 1, halfMeridian = 0,
117 radialDistance = cube_radial_distance_in_m)
118 my_scene.place ( my_cube, my_world)
120 my_world.add_scene (my_scene)
123 if __name__ ==
"__main__":
def LaunchThe3DWorld(jsonFileCategory="Externals")